﻿using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using Lavanderia.Repository.Mapping;
using Lavanderia.Entities;

namespace Lavanderia.Repository
{
    public class LAVANDERIAContext:DbContext
    {
        static LAVANDERIAContext()
        {
            Database.SetInitializer<LAVANDERIAContext>
            (
                null
               // new DropCreateDatabaseIfModelChanges<LAVANDERIAContext>()
               //new DropCreateDatabaseAlways<LAVANDERIAContext>()
                //new LavanderiaDatabaseInitializer()
            );
        }

        public LAVANDERIAContext()
            : base("Name=LAVANDERIAContext")
        {
            this.Configuration.LazyLoadingEnabled = false;
            this.Configuration.ProxyCreationEnabled = false;
            this.Configuration.AutoDetectChangesEnabled = false;
        }

        public DbSet<CLIENTE> CLIENTEs { get; set; }
        public DbSet<DETALLE_VENTA> DETALLE_VENTA { get; set; }
        public DbSet<ESTADO_CIVIL> ESTADO_CIVIL { get; set; }
        public DbSet<FOTO_TRABAJADOR> FOTO_TRABAJADOR { get; set; }
        public DbSet<MENU> MENUs { get; set; }
        public DbSet<OPERADOR> OPERADORs { get; set; }
        public DbSet<PAGO> PAGOes { get; set; }
        public DbSet<PRODUCTO> PRODUCTOes { get; set; }
        public DbSet<ROL> ROLs { get; set; }
        public DbSet<SEXO> SEXOes { get; set; }
        public DbSet<TELEFONOS_TRABAJADOR> TELEFONOS_TRABAJADOR { get; set; }
        public DbSet<TRABAJADOR> TRABAJADORs { get; set; }
        public DbSet<USUARIO> USUARIOs { get; set; }
        public DbSet<USUARIO_MENU> USUARIO_MENU { get; set; }
        public DbSet<VENTA> VENTAs { get; set; }
        public DbSet<CIERRE_CAJA> CIERRE_CAJAs { get; set; }
        public DbSet<EGRESOS> EGRESOS { get; set; }
        public DbSet<HOTEL> HOTELES { get; set; }
        public DbSet<CLIENTE_NATURAL> CLIENTE_NATURALs { get; set; }
        public DbSet<CLIENTE_JURIDICO> CLIENTE_JURIDICOs { get; set; }
        public DbSet<TELEFONOS_CLIENTE> TELEFONO_CLIENTEs { get; set; }
        public DbSet<Empresa> Empresas { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new CLIENTEMap());
            modelBuilder.Configurations.Add(new DETALLE_VENTAMap());
            modelBuilder.Configurations.Add(new ESTADO_CIVILMap());
            modelBuilder.Configurations.Add(new FOTO_TRABAJADORMap());
            modelBuilder.Configurations.Add(new MENUMap());
            modelBuilder.Configurations.Add(new OPERADORMap());
            modelBuilder.Configurations.Add(new PAGOMap());
            modelBuilder.Configurations.Add(new PRODUCTOMap());
            modelBuilder.Configurations.Add(new ROLMap());
            modelBuilder.Configurations.Add(new SEXOMap());
            modelBuilder.Configurations.Add(new TELEFONOS_TRABAJADORMap());
            modelBuilder.Configurations.Add(new TRABAJADORMap());
            modelBuilder.Configurations.Add(new USUARIOMap());
            modelBuilder.Configurations.Add(new USUARIO_MENUMap());
            modelBuilder.Configurations.Add(new VENTAMap());
            modelBuilder.Configurations.Add(new CIERRE_CAJAMap());
            modelBuilder.Configurations.Add(new EGRESOSMap());
            modelBuilder.Configurations.Add(new HOTELMAP());
            modelBuilder.Configurations.Add(new CLIENTE_NATURALMap());
            modelBuilder.Configurations.Add(new CLIENTE_JURIDICOMap());
            modelBuilder.Configurations.Add(new TELEFONO_CLIENTEMap());
            modelBuilder.Configurations.Add(new EmpresaMap());
        }
    }
}
